package com.ch999.detect.View.dialog;

import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.ch999.detect.R;
import com.ch999.detect.View.SelectStartDialog;
import com.scorpio.mylib.utils.AsynImageUtil;

/**
 * Created by zhulang on 2017/7/4.
 */

public class ShowMiaoShuPic extends SelectStartDialog {

    private TextView tvMiaoshu;
    private ImageView imgPic;

    public ShowMiaoShuPic(Context context) {
        super(context);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_layout_showpic);
        tvMiaoshu = (TextView) findViewById(R.id.tv_miaoshu);
        imgPic = (ImageView) findViewById(R.id.img_pic);

        findViewById(R.id.img_close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }


    public void show(String picUrl,String miaoshu) {

        super.show();

        if (!TextUtils.isEmpty(picUrl)) {
            imgPic.setVisibility(View.VISIBLE);
            AsynImageUtil.display(picUrl, imgPic);
        } else {
            imgPic.setVisibility(View.GONE);
        }


        if (!TextUtils.isEmpty(miaoshu)) {
            tvMiaoshu.setVisibility(View.VISIBLE);
            tvMiaoshu.setText(miaoshu);
        } else {
            tvMiaoshu.setVisibility(View.GONE);
        }

    }


}
